package com.dingjian.broker.enums;

/**
 * 客户关系
 * 
 * @author google
 *
 */
public enum CustomerRelationEnum {
	SELF("SELF","本人"), //本人
	HUSBAND("HUSBAND","丈夫"), //丈夫
	WIFE("WIFE","妻子"), //妻子
	KIN("KIN","亲属"), //亲属
	FRIEND("FRIEND","朋友"), //朋友
	SON("SON","儿子"), //儿子 
	OTHER("OTHER","其他"), //其他
	CLASSMATE("CLASSMATE","同学"); //同学
	
	private CustomerRelationEnum(){}
	
	private CustomerRelationEnum(String key,String descript){
			this.key=key;
			this.descript=descript;
	}
	private String key;
	private String descript;
	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public String getDescript() {
		return descript;
	}

	public void setDescript(String descript) {
		this.descript = descript;
	}
	
	/**
	 * 取枚举的json字符串
	 * @return
	 */
	public static String getJsonStr(){
		CustomerRelationEnum[] enums = CustomerRelationEnum.values();
		StringBuffer jsonStr = new StringBuffer("[");
		for (CustomerRelationEnum enumTemp : enums) {
			if(!"[".equals(jsonStr.toString())){
				jsonStr.append(",");
			}
			jsonStr.append("{id:'")
					.append(enumTemp.getKey())
					.append("',name:'")
					.append(enumTemp.getDescript())
					.append("',value:'")
					.append(enumTemp)
					.append("'}");
		}
		jsonStr.append("]");
		return jsonStr.toString();
	}
	
	
}
